﻿using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _05Net8Hosting.HostService
{
    public class MyHostService : IHostedService
    {
        /// <summary>
        /// 应用程序启动时 调用
        /// </summary>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task StartAsync(CancellationToken cancellationToken)
        {
            Console.WriteLine("项目启动加载。。。。。。。。。。。。");
            return Task.CompletedTask;
        }

        /// <summary>
        /// 应用程序停止时 调佣
        /// </summary>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task StopAsync(CancellationToken cancellationToken)
        {
            Console.WriteLine("项目停止");
            return Task.CompletedTask;
        }
    }
}
